package com.myapp.struts.personal;

import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
import org.apache.struts.action.ActionForm;
import org.apache.struts.action.ActionForward;
import org.apache.struts.action.ActionMapping;

public class PersonalPanelAction extends org.apache.struts.action.Action {

    private static final String SUCCESS = "success";
    private static final String SUCURSAL = "sucursal";
    private static final String CLIENTE = "cliente";

    @Override
    public ActionForward execute(ActionMapping mapping, ActionForm form,
            HttpServletRequest request, HttpServletResponse response)
            throws Exception {

        PersonalPanelForm f = (PersonalPanelForm) form;
        request.setAttribute("opcion", f.getOpcion());

        if (f.getOpcion().equals("sucursales")) {
            return mapping.findForward(SUCURSAL);
        }

        return mapping.findForward(SUCCESS);
    }
}
